home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / ADSP.p next >
Encoding:
Text File  |  1993-09-16  |  10.5 KB  |  187 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Sunday, January 6, 1991 at 10:17 PM
  3.     ADSP.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc.    1986-1990
  7.         All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT ADSP;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingADSP}
  21. {$SETC UsingADSP := 1}
  22.  
  23. {$I+}
  24. {$SETC ADSPIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingAppleTalk}
  27. {$I $$Shell(PInterfaces)AppleTalk.p}
  28. {$ENDC}
  29. {$SETC UsingIncludes := ADSPIncludes}
  30.  
  31. CONST
  32.  
  33. { driver control ioResults }
  34. errRefNum = -1280;                                          { bad connection refNum }
  35. errAborted = -1279;                                         { control call was aborted }
  36. errState = -1278;                                           { bad connection state for this operation }
  37. errOpening = -1277;                                         { open connection request failed }
  38. errAttention = -1276;                                       { attention message too long }
  39. errFwdReset = -1275;                                        { read terminated by forward reset }
  40. errDSPQueueSize = -1274;                                    { DSP Read/Write Queue Too small }
  41. errOpenDenied = -1273;                                      { open connection request was denied }
  42.  
  43. {driver control csCodes}
  44. dspInit = 255;                                              { create a new connection end }
  45. dspRemove = 254;                                            { remove a connection end }
  46. dspOpen = 253;                                              { open a connection }
  47. dspClose = 252;                                             { close a connection }
  48. dspCLInit = 251;                                            { create a connection listener }
  49. dspCLRemove = 250;                                          { remove a connection listener }
  50. dspCLListen = 249;                                          { post a listener request }
  51. dspCLDeny = 248;                                            { deny an open connection request }
  52. dspStatus = 247;                                            { get status of connection end }
  53. dspRead = 246;                                              { read data from the connection }
  54. dspWrite = 245;                                             { write data on the connection }
  55. dspAttention = 244;                                         { send an attention message }
  56. dspOptions = 243;                                           { set connection end options }
  57. dspReset = 242;                                             { forward reset the connection }
  58. dspNewCID = 241;                                            { generate a cid for a connection end }
  59.  
  60. { connection opening modes }
  61. ocRequest = 1;                                              { request a connection with remote }
  62. ocPassive = 2;                                              { wait for a connection request from remote }
  63. ocAccept = 3;                                               { accept request as delivered by listener }
  64. ocEstablish = 4;                                            { consider connection to be open }
  65.  
  66. { connection end states }
  67. sListening = 1;                                             { for connection listeners }
  68. sPassive = 2;                                               { waiting for a connection request from remote }
  69. sOpening = 3;                                               { requesting a connection with remote }
  70. sOpen = 4;                                                  { connection is open }
  71. sClosing = 5;                                               { connection is being torn down }
  72. sClosed = 6;                                                { connection end state is closed }
  73.  
  74. { client event flags }
  75. eClosed = $80;                                              { received connection closed advice }
  76. eTearDown = $40;                                            { connection closed due to broken connection }
  77. eAttention = $20;                                           { received attention message }
  78. eFwdReset = $10;                                            { received forward reset advice }
  79.  
  80. { miscellaneous constants }
  81. attnBufSize = 570;                                          { size of client attention buffer }
  82. minDSPQueueSize = 100;                                      { Minimum size of receive or send Queue }
  83.  
  84. TYPE
  85. { connection control block }
  86. TPCCB = ^TRCCB;
  87. TRCCB = PACKED RECORD
  88.     ccbLink: TPCCB;                                         { link to next ccb }
  89.     refNum: INTEGER;                                        { user reference number }
  90.     state: INTEGER;                                         { state of the connection end }
  91.     userFlags: Byte;                                        { flags for unsolicited connection events }
  92.     localSocket: Byte;                                      { socket number of this connection end }
  93.     remoteAddress: AddrBlock;                               { internet address of remote end }
  94.     attnCode: INTEGER;                                      { attention code received }
  95.     attnSize: INTEGER;                                      { size of received attention data }
  96.     attnPtr: Ptr;                                           { ptr to received attention data }
  97.     reserved: PACKED ARRAY [1..220] OF Byte;                { adsp internal use }
  98.     END;
  99.  
  100. {driver control call parameter block}
  101. DSPPBPtr = ^DSPParamBlock;
  102. DSPParamBlock = PACKED RECORD
  103.     qLink: QElemPtr;
  104.     qType: INTEGER;
  105.     ioTrap: INTEGER;
  106.     ioCmdAddr: Ptr;
  107.     ioCompletion: ProcPtr;
  108.     ioResult: OSErr;
  109.     ioNamePtr: StringPtr;
  110.     ioVRefNum: INTEGER;
  111.     ioCRefNum: INTEGER;                                     { adsp driver refNum }
  112.     csCode: INTEGER;                                        { adsp driver control code }
  113.     qStatus: LONGINT;                                       { adsp internal use }
  114.     ccbRefNum: INTEGER;                                     { refnum of ccb }
  115.     CASE INTEGER OF
  116.       dspInit,dspCLInit:
  117.         (ccbPtr: TPCCB;                                     {pointer to connection control block}
  118.          userRoutine: ProcPtr;                              {client routine to call on event}
  119.          sendQSize: INTEGER;                                {size of send queue (0..64K bytes)}
  120.          sendQueue:  Ptr;                                   {client passed send queue buffer}
  121.          recvQSize: INTEGER;                                {size of receive queue (0..64K bytes)}
  122.          recvQueue: Ptr;                                    {client passed receive queue buffer}
  123.          attnPtr: Ptr;                                      {client passed receive attention buffer}
  124.          localSocket: Byte;                                 {local socket number}
  125.          filler1: Byte;                                     {filler for proper byte alignment}
  126.           );
  127.           dspOpen,dspCLListen,dspCLDeny:
  128.             (localCID: INTEGER;                             {local connection id}
  129.              remoteCID: INTEGER;                            {remote connection id}
  130.              remoteAddress: AddrBlock;                      {address of remote end}
  131.              filterAddress: AddrBlock;                      {address filter}
  132.              sendSeq: LONGINT;                              {local send sequence number}
  133.              sendWindow: INTEGER;                           {send window size}
  134.              recvSeq: LONGINT;                              {receive sequence number}
  135.              attnSendSeq: LONGINT;                          {attention send sequence number}
  136.              attnRecvSeq: LONGINT;                          {attention receive sequence number}
  137.              ocMode: Byte;                                  {open connection mode}
  138.              ocInterval: Byte;                              {open connection request retry interval}
  139.              ocMaximum: Byte;                               {open connection request retry maximum}
  140.              filler2: Byte;                                 {filler for proper byte alignment}
  141.               );
  142.               dspClose,dspRemove:
  143.                 (abort: Byte;                               {abort connection immediately if non-zero}
  144.                  filler3: Byte;                             {filler for proper byte alignment}
  145.                   );
  146.                   dspStatus:
  147.                     (statusCCB: TPCCB;                      {pointer to ccb}
  148.                      sendQPending: INTEGER;                 {pending bytes in send queue}
  149.                      sendQFree: INTEGER;                    {available buffer space in send queue}
  150.                      recvQPending: INTEGER;                 {pending bytes in receive queue}
  151.                      recvQFree: INTEGER;                    {available buffer space in receive queue}
  152.                       );
  153.                       dspRead,dspWrite:
  154.                         (reqCount: INTEGER;                 {requested number of bytes}
  155.                          actCount: INTEGER;                 {actual number of bytes}
  156.                          dataPtr: Ptr;                      {pointer to data buffer}
  157.                          eom: Byte;                         {indicates logical end of message}
  158.                          flush: Byte;                       {send data now}
  159.                           );
  160.                           dspAttention:
  161.                             (attnCode: INTEGER;             {client attention code}
  162.                              attnSize: INTEGER;             {size of attention data}
  163.                              attnData: Ptr;                 {pointer to attention data}
  164.                              attnInterval: Byte;            {retransmit timer in 10-tick intervals}
  165.                              filler4: Byte;                 {filler for proper byte alignment}
  166.                               );
  167.                               dspOptions:
  168.                                 (sendBlocking: INTEGER;     {quantum for data packets}
  169.                                  sendTimer: Byte;           {send timer in 10-tick intervals}
  170.                                  rtmtTimer: Byte;           {retransmit timer in 10-tick intervals}
  171.                                  badSeqMax: Byte;           {threshold for sending retransmit advice}
  172.                                  useCheckSum: Byte;         {use ddp packet checksum}
  173.                                   );
  174.                                   dspNewCID:
  175.                                     (newCID: INTEGER;       {new connection id returned}
  176.                                       );
  177.     END;
  178.  
  179.  
  180.  
  181. {$ENDC}    { UsingADSP }
  182.  
  183. {$IFC NOT UsingIncludes}
  184.     END.
  185. {$ENDC}
  186.  
  187.